package com.example.config;

import com.example.entity.FactoryBeanEntity;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author mingtian
 * @version V1.0
 * @Description FactoryBean 向 Spring 容器中注入对象
 * @date 2019/12/9 16:02
 */
public class MyFactoryBean implements FactoryBean<FactoryBeanEntity> {
    /**
     * 获取 bean 对象
     *
     * @return
     * @throws Exception
     */
    public FactoryBeanEntity getObject() throws Exception {
        return new FactoryBeanEntity();
    }

    /**
     * 获取对象类型
     *
     * @return
     */
    public Class<?> getObjectType() {
        return FactoryBeanEntity.class;
    }

    /**
     * 判断是否为单例  true：表示单例；false:表示不是单例
     *
     * @return
     */
    public boolean isSingleton() {
        return false;
    }
}
